﻿CREATE OR REPLACE FUNCTION loop_f() RETURNS void AS $$
BEGIN
	FOR i IN 1 .. 1000 LOOP
		--PERFORM * FROM Customers WHERE "CustomerID" < 'DDY' ORDER BY "ContactName";
		PERFORM * FROM Customers WHERE "CustomerID" < 'DDY' AND "ContactTitle" = 'Owner' ORDER BY "ContactName";
	END LOOP;
END;
$$ LANGUAGE plpgsql;

SELECT * FROM Customers WHERE "CustomerID" < 'DDY' AND "ContactTitle" = 'Owner' ORDER BY "ContactName";
SELECT loop_f();

--DROP INDEX IF EXISTS customers_id_i;
--CREATE INDEX customers_id_i ON Customers ("CustomerID");
--DROP INDEX IF EXISTS customers_id_i;

DROP INDEX IF EXISTS invisible;